<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
	<head>
		<%@ include file="/common/taglibs.jsp"%>
		<title>sinlog</title>
	</head>
	<body>
	<div class="mainContent">
		<div class="searDiv">
			<table class="searTb">
				<tr>
					<td><table>
						<tr>
							<td width="100" align="right"><label>类型代码：</label></td>
							<td><label id="q_typeCode">${paramType.typeCode}</label></td>
						</tr>
					</table></td>
				</tr>
			</table>
		</div>
		<div class="dgDiv">
			<table id="dg"></table> 
		</div>
	</div>
<script type="text/javascript">
	$(document).ready(function(){
		$('#dg').datagrid({   
		    url:'${ctx}/param!listParam.action',   
		    pagination:true,
		    height: getDgH('dgDiv') - 55,
		    pageSize:30,
		    pageList:[30,60,100,200], 
		    columns:[[   
		        {checkbox:true,field:'ck'},
		        {title:'参数值',field:'paramValue',width:200},
		        {title:'参数中文值',field:'paramValueCn',width:200},
		        {title:'顺序',field:'sortOrder',width:100},
		        {field:'editor',title:'操作',width:100,align:'center',formatter:function(value,row,index){
					var ed = '<a class="dicon icon-search" title="详细" onclick=goView(\''+row.paramId+'\')></a>&nbsp;';
					ed += '<a class="dicon icon-edit" title="修改" onclick=goEdit(\''+row.paramId+'\')></a>&nbsp;';
					ed += '<a class="dicon icon-remove" title="删除" onclick=goDelete('+null+',\''+row.paramId+'\')></a>';
					return ed;
				}}
		    ]],
		    toolbar:[{
		    	text:'新增',  
				iconCls: 'icon-add',
				handler: goAdd
			},{
		    	text:'删除',  
				iconCls: 'icon-remove',
				handler: goDelete
			}],
		    queryParams:{
		       'q_typeId_eq_s': '${paramType.typeId}'
		   	},
		   	onDblClickRow:function(rowIndex, rowData){
		   		goEdit(rowData.paramId);
		   	}
		}); 
	});
	function goAdd(){
		openMenu('参数管理-新增参数','${ctx}/param!addParam.action?comParam.typeId=${paramType.typeId}');
	}
	function goEdit(id){
		openMenu('参数管理-修改参数','${ctx}/param!editParam.action?comParam.typeId=${paramType.typeId}&comParam.paramId='+id);
	}
	function goView(id){
		openMenu('参数管理-查看参数','${ctx}/param!viewParam.action?comParam.typeId=${paramType.typeId}&comParam.paramId='+id);
	}
	function goDelete(event,id){
		var ids = '';
		if(id){
			ids = id;
		}else{
			var ids = getCkIds('dg','paramId');
		}
		if(ids == ''){
			$.messager.alert('系统提示','请选择要操作的记录！','info');
		}else{
			$.messager.confirm('系统提示','确定执行该操作？',function(r){
				if(r){
					wait();
					Util.doAjaxPost('${ctx}/param!deleteParam.action',{ids:ids},function(text){
						uwait();
						var ret = jQuery.parseJSON(text);
						if(ret.success){
							doQuery();
						}else{
							$.messager.alert('系统提示','操作失败！','error');
						}
					});
				}
			});
		}
	}
</script>
	</body>
</html>